/*
 * Shader.h
 *
 *  Created on: 24-06-2013
 *      Author: Jarek
 */

#ifndef SHADER_H_
#define SHADER_H_

#include "GlobalData.h"
#include "ECameraLogic.h"
#include "ECamera.h"
#include "EWorld.h"
#include "EMesh.h"
#include "EModel.h"
#include "ELight.h"

class Shader {
public:
	GLuint vertexShaderHandler;
	GLuint fragmentShaderHandler;

	GLchar* vertexShaderBuffer;
	GLchar* fragmentShaderBuffer;

	GLuint programHandler;
	static GLuint activeProgram;

	char* name;
	char* description;

public:
	Shader();
	virtual ~Shader();

	bool createShader(char* VSPath, char* FSPath);
	bool createShaderWithBuffers(GLchar* VSBuffer, GLchar* FSBuffer);

	bool createProgram();

	void useProgram();

	void removeBuffer();
	void removeShader();
	void removeProgram();
	void destroy();

	static GLuint getShaderProgram(char* VSFileName, char* FSFileName);
	static GLuint getShaderProgramWithBuffers(GLchar* VSBuffer, GLchar* FSBuffer);

	virtual void setUniformMatrix3x3f(GLint handle, GLfloat* matrix);
	virtual void setUniformMatrix4x4f(GLint handle, GLfloat* matrix);
	virtual void useAttributes(bool isAtrributes = true) {}
	virtual void useShaderOnMesh(const Mesh& mesh) {}
};

#endif /* SHADER_H_ */
